import { LIST_USER, CREATE_USER, DELETE_USER } from '../actions/types'
const userReducer = (state={}, action) => {
    switch (action.type) {
      case LIST_USER:
        console.log('userReducer:', action)
        return {...state, error: '', data: action.payload.data, total: action.payload.total}
      case CREATE_USER:
        localStorage.removeItem('info');
        return {...state, info: action.payload}
      case DELETE_USER:
        return {...state, info: action.payload}
      default:
        return state;
    }
}

export default userReducer;